package hari3.latihan;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;

public class BacaFileCommons {
	public static void main(String[] args) throws Exception {
		File in = new File("src/hari2/latihan/quotes.txt");
	//	String content = IOUtils.toString(in); // menampilkan lgsg satu file
		//List lines = FileUtils.readLines(in);
		LineIterator it = FileUtils.lineIterator(in, "UTF-8");
		//IOUtils.closeQuietly(in);
		try {
			int n = 1;
			while (it.hasNext()) {
				String line = it.nextLine();
				System.out.println(n + " " + line);
				n++;
			}
		} finally{
			LineIterator.closeQuietly(it);
		}
	}
}
